package jdbc.view;

import jdbc.controller.UserController;
import jdbc.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Author：汤小洋
 * Date：2023-07-04 16:53
 * Description：<描述>
 */
public class UserView {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("jdbc/spring.xml");
        UserController userController = (UserController) ac.getBean("userController");

        User user = new User();
        user.setUsername("lucy");
        user.setPassword("123");
        userController.register(user);
        System.out.println("注册成功！");

        // try {
        //     User user = userController.login("admin", "345");
        //     System.out.println("登录成功！");
        // } catch (Exception e) {
        //     System.out.println("登录失败！");
        //     throw new RuntimeException(e);
        // }

    }
}
